package cn.bdqn.repository;

import cn.bdqn.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface UserRepository extends JpaRepository<User,Long>, JpaSpecificationExecutor<User> {
//    @Query("FROM User WHERE usrRoleId = ?1")
//    @Query("FROM User WHERE usrRoleId = :roleId")
    @Query(value="SELECT * FROM `sys_user` where `usr_role_id` = 1?",nativeQuery=true)
    public List<User> selectById(Long roleId);

    public List<User> queryByUsrName(String usrName);

    public List<User> queryByUsrNameLike(String usrName);

    public List<User> queryByUsrNameOrUsrPassword(String userName,String password);
}
